import codecs

fs = codecs.open('log2.txt', mode='a', encoding='utf8')
fs.writelines('测试中文')